package cn.com.cetccst.dataupload;

import static cn.com.cetccst.tools.kv.CommonKV.kvStore;

import android.content.Context;
import android.text.TextUtils;

import cn.com.cetccst.dataupload.kv.KVKeys;
import cn.com.cetccst.dataupload.network.DataUploadHttpRequester;
import cn.com.cetccst.dataupload.sync.compliance.ComplianceRecordManager;
import cn.com.cetccst.dataupload.sync.restriction.RestrictionStatusManager;

public class DataUploadManager {

    private static DataUploadManager instance;

    private DataUploadManager(Context context) {
        ComplianceRecordManager.initialize(context);
        RestrictionStatusManager.initialize(context);
        if (!TextUtils.isEmpty(kvStore.decodeString(KVKeys.KEY_BASE_URL))) {
            DataUploadHttpRequester.initialize(context, kvStore.decodeString(KVKeys.KEY_BASE_URL));
        }
    }

    /**
     * @param context
     */
    public static void initialize(Context context) {

        if (instance == null)
            instance = new DataUploadManager(context);
    }

    public static DataUploadManager get() {
        return instance;
    }

}
